package day10.edu;

// Created: 10/09/2025, ChangJiang Ru
public class DivisonDemo {
    public static void main(String[] args) {

        try{
        int n = Integer.parseInt(args[0]);
        int m = Integer.parseInt(args[1]);

        int result = divide(m, n);
        }catch(BelowZeroException e)
        {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }catch(NumberFormatException e)
        {
            System.out.println("You input the number format is error");
        }catch(ArrayIndexOutOfBoundsException e)
        {
            e.printStackTrace();
            System.out.println("You array index out of bounds in error");
        }catch(ArithmeticException e)
        {
            System.out.println("You arithmetic is error");
        }

    }

    public static int divide(int m, int n) throws BelowZeroException
    {
        if(m < 0 || n < 0)
            throw new BelowZeroException("You have input the error");
        return m / n;
    }
}
